<template>
  <div class="task-title-bar">
    <el-date-picker
      v-model="dateInner"
      size="mini"
      type="date"
      placeholder="选择日期"
    >
    </el-date-picker>
    <button type="button" class="todo__btn">ADD</button>
  </div>
</template>

<script>
export default {
  name: 'TitleBar',
  data () {
    return {
      dateInner: new Date('Fri May 18 2018 00:00:00 GMT+0800')
    }
  },
  props: {
    date: Date
  },
  watch: {
    date: {
      handler: function (date) {
        this.dateInner = date
      },
      immediate: true
    },
    dateInner () {
      this.$emit('update:date', this.dateInner)
    }
  }
}
</script>

<style lang="stylus">
  .task-title-bar
    border-bottom 1px solid #e5e5e5
    padding: 10px
</style>
